/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pig.mt.controller;

import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.mt.entity.WxArticle;
import com.pig4cloud.pig.mt.enums.ArticleTypeEnum;
import com.pig4cloud.pig.mt.service.WxArticleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * CMS文章中心
 *
 * @author JLM
 * @date 2021-03-05 11:45:08
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/article" )
@Api(value = "article", tags = "CMS文章中心管理")
public class WxArticleController {

    private final  WxArticleService wxArticleService;


//    /**
//     * 通过id查询CMS文章中心
//     * @param id id
//     * @return R
//     */
//    @ApiOperation(value = "通过id查询", notes = "通过id查询")
//    @GetMapping("/detail" )
//    public R getById(String id) {
//		WxArticle article = wxArticleService.findById(id);
//        return R.ok(article);
//    }
//
//	/**
//	 * 查看目录
//	 *
//	 * @param category
//	 * @return
//	 */
//	@GetMapping("/category")
//	public R getQuestions(String type, String category) {
//		ArticleTypeEnum articleType = ArticleTypeEnum.of(type);
//		if (articleType == null) {
//			return R.failed("文章类型有误");
//		}
//		List<WxArticle> articles = wxArticleService.selectCategory(articleType, category);
//		return R.ok(articles);
//	}
//
//	/**
//	 * 文章搜索
//	 *
//	 * @param category
//	 * @param keywords
//	 * @return
//	 */
//	@GetMapping("/search")
//	public R getQuestions(String type,
//						  @RequestParam(required = false) String category,
//						  @RequestParam(required = false) String keywords) {
//		ArticleTypeEnum articleType = ArticleTypeEnum.of(type);
//		if (articleType == null) {
//			return R.failed("文章类型有误");
//		}
//		if (StringUtils.isEmpty(keywords)) {
//			return R.failed("关键词不得为空");
//		}
//		List<WxArticle> articles = wxArticleService.search(articleType, category, keywords);
//		return R.ok(articles);
//	}

}
